from dataclasses import dataclass


@dataclass()
class Hero:
    name: str
    attack_val: int
    hp: int
    tags: list
    speed: int
    position_x: int
    position_y: int

    def attack(self, another):
        print("开始时:another.hp={}".format(another.hp))
        another.hp -= self.attack_val
        print("结束时:another.hp={}".format(another.hp))

    def move(self, x, y):
        print("开始的位置({},{})"
              .format(self.position_x, self.position_y))
        self.position_x += x
        self.position_y += y
        print("结束的位置({},{})"
              .format(self.position_x, self.position_y))


cyj = Hero("程咬金", 100, 1000, ['战士', '坦克'], 20, 100, 200)
zy = Hero("赵云", 120, 800, ['战士', '刺客'], 20, 100, 200)

zy.attack(cyj)
zy.move(-1, 12)

print(cyj)
print(zy)
